#include <iostream>
#include<vector>
using namespace std;

int main() {
    int left=0;
    int rightest=0;
    int n;
    cin>>n;
    int step=0;
    vector<int> v(n);
    for(int i=0;i<n;i++) cin>>v[i];
    while(rightest<n-1)
    {
        int tmp=left;
        int end=rightest;
        left=rightest+1;
        for(int i=tmp;i<=end;i++)
        {
            rightest=max(i+v[i],rightest);
        }
        if(left>rightest)
        {
            cout<<-1;
            return 0;
        }
        step++;

    }
    cout<<step;
    return 0;

}